fix: electric-indent-mode caused too many treesit-ready-p calls #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When electric-indent-mode was enabled, it called
treesit-language-at-point-function
that later calledtreesit-ready-p
too many times.I've created a memoization function that uses buffer local alist to store value of
treesit-ready-p
. This should cover the case when we have all the needed grammars for one buffer but for some reason we don't have it in another one.Maybe there is no need for that memoization to be buffer local.
Also I tried suggestion from #9 but ended up using a separate function that can be used outside derived mode declaration.
Fixes #9